{% extends 'common/base.html' %}
{% block css %}
    <link href="{{ url_for('static',filename='css/plugins/bootstrap-datetimepicker.min.css') }}" rel="stylesheet"/>
{% endblock %}
{% block content %}
    <section class="content-header">
        <div>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 题库管理</a></li>
                <li class="active">考试列表</li>
            </ol>
        </div>
    </section>
    <section class="content" id="showcontent">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">添加考试</h3>
                    </div>
                    <form role="form" method="post" class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="input_test_id" class="control-label col-xs-4">
                                    {{ form.test_id.label }}</label>
                                <div class="col-xs-4">
                                    {{ form.test_id }}
                                </div>
                                {% for err in form.test_id.errors %}
                                    <div class="col-md-12">
                                        <p style="color: red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_time" class="col-xs-4 control-label">
                                    {{ form.time.label }}</label>
                                <div class="col-xs-4">
                                    {{ form.time }}
                                </div>
                                {% for err in form.time.errors %}
                                    <div class="col-md-12">
                                        <p style="color: red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_startTime" class="control-label col-xs-4">
                                    {{ form.startTime.label }}</label>
                                <div class="col-xs-4">
                                    {{ form.startTime }}
                                </div>
                                {% for err in form.startTime.errors %}
                                    <div class="col-md-12">
                                        <p style="color: red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_endTime" class="col-xs-4 control-label">
                                    {{ form.endTime.label }}</label>
                                <div class="col-xs-4">
                                    {{ form.endTime }}
                                </div>
                                {% for err in form.endTime.errors %}
                                    <div class="col-md-12">
                                        <p style="color: red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_members" class="col-xs-4 control-label">
                                    {{ form.members.label }}</label>
                                <div class="col-xs-4">
                                    <div style="border: 1px gainsboro solid;max-height: 200px;padding: 5px 10px;">
                                        {% for member in members %}
                                            <div style="line-height: inherit;height: 25px">
                                                {{ form.members(value=member.id) }}{{ member.username }}</div>
                                        {% endfor %}
                                    </div>
                                </div>
                                {% for err in form.members.errors %}
                                    <div class="col-md-12">
                                        <p style="color: red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                        </div>
                        <div class="box-footer" style="text-align: center">
                            {{ form.csrf_token }}
                            {{ form.submit }}
                            <a href="{{ url_for("main.exam_list") }}" class="float-right btn">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!--内容-->
{% endblock %}
{% block js %}
    <script src="{{ url_for('static',filename='js/plugins/bootstrap-datetimepicker.min.js') }}"></script>
    <script>
        $(function () {
            $("#is_public").addClass("list-inline");
            $("#is_public li").css("margin", "0 40px");
            $('#startTime').datetimepicker({
                todayBtn: 1,
                autoclose: 1,
                weekStart: 1,
                todayHighlight: 1,
                startView: 2,
                format:"yyyy-mm-dd hh:ii:00"
            });
            $('#endTime').datetimepicker({
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                format:"yyyy-mm-dd hh:ii:00"
            });
        })
    </script>
{% endblock %}